<template>
  <div class="carousel-container">
<!--    style="aspect-ratio: 4/3; height: 100%;"-->
    <el-carousel :interval="4000" type="card"
                     height="400px" width=auto
    > <!-- 修改：调整轮播图的高度 -->
      <el-carousel-item v-for="(item, index) in items" :key="index">
        <img :src="item" alt="carousel" class="carousel-image" />
      </el-carousel-item>
    </el-carousel>
  </div>
</template>

<script>
export default {
  name: 'CarouselComponent',
  data() {
    return {
      items: [
        require('@/assets/bg.jpg'),
        require('@/assets/bg4.jpg'),
        require('@/assets/bg2.jpg'),
        require('@/assets/bg3.png'),
      ],
    };
  },
};
</script>

<style scoped>
.carousel-container {
  width: 100%;
  margin: 20px 0; /* 修改：减少轮播图容器的上下间距 */
}

.carousel-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
</style>
